package mhcs.client;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.PopupPanel;

public class GPSButton extends Button {
	
	public GPSButton(){
		super("Load From GPS");
		final PopupPanel popup = new PopupPanel(true);
		popup.add(new GPSController());
		addClickHandler(new ClickHandler() {
			public void onClick(ClickEvent event) {
				popup.setPopupPositionAndShow(new PopupPanel.PositionCallback() {
					public void setPosition(int offsetWidth, int offsetHeight) {
						int left = (Window.getClientWidth() - offsetWidth) / 3;
						int top = (Window.getClientHeight() - offsetHeight) / 3;
						popup.setPopupPosition(left, top);
					}
				});
          }
        });

	}
	
	
	
//	public GPSButton() {
//		
//		class GpsPopup extends PopupPanel {
//			public GpsPopup() {
//				super("GPS Controller");
//				VerticalPanel vp = new VerticalPanel();
//				vp.add(new GPSController());
//				add(vp);
//			}
//		}
//		
//		Button openPopup = new Button("Load GPS");
//		openPopup.addClickHandler(new ClickHandler() {
//
//			@Override
//			public void onClick(ClickEvent event) {
//				//make popup for gps
//				GpsPopup gpsPopup = new GpsPopup();
//				gpsPopup.show();
//			}
//			
//		});
	//}
}
